﻿<UserControl x:Class="PortableDeviceExplorer.PortableDeviceViewer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:PortableDeviceLib;assembly=PortableDeviceLib"
    DataContext="{Binding Path=PortableDeviceViewerViewModel, Source={StaticResource Locator}}"
    >

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="350" />
        </Grid.RowDefinitions>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <TextBlock Text="Device Id" Margin="5" HorizontalAlignment="Right" />
            <TextBlock Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding Path=PortableDevice.DeviceId}" Margin="5" />

            <TextBlock Grid.Row="1" Grid.Column="0" Text="Friendly name" Margin="5" HorizontalAlignment="Right" />
            <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=PortableDevice.FriendlyName}" Margin="5" />

            <TextBlock Grid.Row="1" Grid.Column="2" Text="Device model" Margin="5" HorizontalAlignment="Right" />
            <TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding Path=PortableDevice.Model}" Margin="5" />
            
            <TextBlock Grid.Row="2" Grid.Column="0" Text="Device type" Margin="5" HorizontalAlignment="Right" />
            <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=PortableDevice.DeviceType}" Margin="5" />
        </Grid>


        <TreeView Grid.Row="1" Margin="5" VerticalAlignment="Stretch" ItemsSource="{Binding Path=PortableDevice.Content.Childs}" />

        <GroupBox Grid.Row="2" Header="Device capabilities">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.50*" />
                    <ColumnDefinition Width="0.50*" />
                </Grid.ColumnDefinitions>

                <TextBlock Text="Supported commands" />
                <ItemsControl Grid.Row="1" ItemsSource="{Binding Path=PortableDevice.DeviceCapabilities.Commands}" />

                <TextBlock Grid.Column="1" Text="Supported events" />
                <ItemsControl Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Path=PortableDevice.DeviceCapabilities.Events}" />
            </Grid>
        </GroupBox>
    </Grid>

</UserControl>
